package drds.data_propagate.instance.spring;

import binlog_consume.instance.core.AbstractInstance;
import binlog_consume.instance.core.CanalMQConfig;
import data_propagate.meta.MetaManager;
import drds.data_propagate.common.alarm.AlarmHandler;
import drds.data_propagate.parse.EventParser;
import drds.data_propagate.sink.EventSink;
import drds.data_propagate.store.Event;
import drds.data_propagate.store.EventStore;
import drds.propagate.protocol.Entry;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.util.List;

/**
 * 基于spring容器启动canal实例，方便独立于manager启动
 *
 * @author jianghang 2012-7-12 下午01:21:26
 * @author zebin.xuzb
 * @version 1.0.0
 */
public class InstanceWithSpring extends AbstractInstance {

    private static final Logger logger = LoggerFactory.getLogger(InstanceWithSpring.class);

    public void start() {
        logger.info("start CannalInstance for {}-{} ", new Object[]{1, destination});
        super.start();
    }

    // ======== setter ========

    public void setDestination(String destination) {
        this.destination = destination;
    }

    public void setEventParser(EventParser eventParser) {
        this.eventParser = eventParser;
    }

    public void setEventSink(EventSink<List<Entry>> eventSink) {
        this.eventSink = eventSink;
    }

    public void setEventStore(EventStore<Event> eventStore) {
        this.eventStore = eventStore;
    }

    public void setMetaManager(MetaManager metaManager) {
        this.metaManager = metaManager;
    }

    public void setAlarmHandler(AlarmHandler alarmHandler) {
        this.alarmHandler = alarmHandler;
    }

    public void setMqConfig(CanalMQConfig mqConfig) {
        this.mqConfig = mqConfig;
    }

}
